package edu.zut.main.thread;

public class ThreadDemo4 {

    public static void main(String[] args) {
        //匿名内部类创建线程
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + "执行");
            }
        }, "thread-A");
        thread.start();

        //利用lambda表达式
        Thread thread2 = new Thread(() -> {
            System.out.println(Thread.currentThread().getName() + "执行");
        }, "thread-B");

        thread2.start();
    }

}
